package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.dao.OldPeopleDao;
import com.woniuxy.propertyjava.dao.RegisteredDao;
import com.woniuxy.propertyjava.entity.OldPeople;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.entity.Registered;
import com.woniuxy.propertyjava.service.OldPeopleService;
import com.woniuxy.propertyjava.service.RegisteredService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class OldPeopleServiceImpl implements OldPeopleService {

    @Resource
    OldPeopleDao oldPeopleDao;

    //根据id查询数据
    @Override
    public OldPeople getqueryById(Integer opid) {
        return this.oldPeopleDao.queryById(opid);
    }

    //分页查询
    @Override
    public PageBean<OldPeople> getAllOldPeople(OldPeople oldPeople,int pageIndex, int pageSize) {
        PageBean<OldPeople> pageBean=new PageBean<>();
        pageBean.setBeanList(oldPeopleDao.queryAllOldPeople(oldPeople,pageIndex,pageSize));
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecode(oldPeopleDao.count());
        return pageBean;
    }

    //添加
    @Override
    public void getinsert(OldPeople oldPeople) {
        oldPeopleDao.insert(oldPeople);
    }

    //删除
    @Override
    public void getdeleteById(Integer opid) {
        oldPeopleDao.deleteById(opid);
    }

    //修改
    @Override
    public void getupdate(OldPeople oldPeople) {
        oldPeopleDao.update(oldPeople);
    }

}
